We study some tech stock price through data visualization and some financial technique, focusing on those which are intended to give a sort of reliable prevision to permit brokers have a basis on which they could decide when it is the best moment to sell or buy stocks. We first analyze a year of data about the biggest companies as Amazon, Google, Apple and Microsoft but right after that we focus on Google stocks. At the end we leave the financial tools for more advanced machine learning technicques such as linear regression. We applied it first on the last 6 years of Google Trends about the word 'google' specifically searched in the financial news domain versus the last 6 years Google stock prices. Then we do a similar prevision, but based on twitter sentiment analysis in a brief period of time. At last we compute prediction based on a multivariate input, i.e. we use other stock prices to compute first a multivariate linear regression and at last a SVM.
keywords : Finance, Stock Price Analysis, MACD, Machine Learning, Linear Regression, SVM, SVR, Data Visualization, Python, R
import pandas as pd
from pandas import Series,DataFrame
import numpy as np
# For Visualization
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_style('whitegrid')
%matplotlib inline
# For reading stock data from yahoo or google
from pandas.io.data import DataReader
# For time stamps
from datetime import datetime
# suppressing warnings
import warnings
warnings.filterwarnings('ignore')
# interactive plots
import plotly.plotly as py
import cufflinks as cf
import plotly.tools as tls
tls.set_credentials_file(username='affinito', api_key='')
#from plotly import __version__
from plotly.offline import download_plotlyjs, init_notebook_mode, iplot
init_notebook_mode()